package atguigu.gxstest;

public class CreatThreadByExtends {
    public static void main(String[] args) throws InterruptedException {
        MyThread myThread = new MyThread();
        myThread.start();

       new Thread(){
           @Override
           public void run() {
               for (int i = 0; i < 20; i++) {
                   if (i % 3 == 0){
                       System.out.println(i+"匿名子类");
                   }
               }
           }
       }.start();

        for (int i = 0; i < 20; i++) {
            System.out.println(i+"main");
        }
    }
}

class MyThread extends Thread{

    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            System.out.println(i+"MyThread");
        }
    }
}
